<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div>one</div>',
            '<div>two</div>',
            '|<br>',
        '</div>',
    ].join(''),
    'insertText abc',
    [
        '<div contenteditable>',
            '<div>one</div>',
            '<div>two</div>',
            'abc|',
        '</div>',
    ].join('')),
    'insertText at end before BR');

test(() => assert_selection(
    [
        '<div contenteditable>',
            '<div>one</div>',
            '<div>two</div>',
            '|<br>\n',
        '</div>',
    ].join(''),
    'insertText abc',
    [
        '<div contenteditable>',
            '<div>one</div>',
            '<div>two</div>',
            'abc|\n',
        '</div>',
    ].join('')),
    'insertText at end before newline');
</script>
